package com.example.exceptiondemo.controller;

import com.example.exceptiondemo.entity.R;
import com.example.exceptiondemo.exception.BussinessException;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: YXC
 * @time: 2022/9/5 15:08
 **/
@RestController
@RequestMapping("/demo")
public class DemoController {

    @GetMapping("null")
    public R nullPoint() throws Exception {
        // 全局异常捕获时，写父类，抛出子类，可以捕获
        throw new BussinessException("错误");
    }

}
